package com.zzzy.doc.dao.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.zzzy.doc.dto.DataRegionDto;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Getter;
import lombok.Setter;

import java.time.LocalDateTime;
import java.util.List;

/**
 * 公文套红模板
 *
 * @author fc
 * @since 2024-08-28
 */
@Getter
@Setter
@TableName(value = "doc_red_sheet_template", autoResultMap = true)
@Schema(description = "公文套红模板")
public class DocRedSheetTemplate {

    @Schema(description = "ID")
    @TableId(value = "id", type = IdType.AUTO)
    private Long id;

    @Schema(description = "模板名称")
    @TableField("`name`")
    private String name;

    @Schema(description = "二进制流")
    @TableField("file_blob")
    private byte[] fileBlob;

    @Schema(description = "预置可编辑区域")
    @TableField(value = "init_data_regions", typeHandler = JacksonTypeHandler.class)
    private List<DataRegionDto> initDataRegions;

    @Schema(description = "可编辑区域")
    @TableField(value = "data_regions", typeHandler = JacksonTypeHandler.class)
    private List<DataRegionDto> dataRegions;

    @Schema(description = "状态：新建、启用、停用")
    @TableField("`status`")
    private String status;

    @Schema(description = "创建用户ID")
    @TableField("user_id")
    private Long userId;

    @Schema(description = "创建用户姓名")
    @TableField("user_name")
    private String userName;

    @Schema(description = "新建时间")
    @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
    @TableField("create_time")
    private LocalDateTime createTime;

    @Schema(description = "修改时间")
    @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
    @TableField("update_time")
    private LocalDateTime updateTime;

    @Schema(description = "说明")
    @TableField("memo")
    private String memo;
}
